// worker.js
const Help = require("../help.js");
const fs = require('fs');
const path = require('path');
async function one_file_download(down_file_object){
  let _down_file_object=await Help.one_file_download(down_file_object)
  process_send(_down_file_object)
}
function process_send(down_file_object){
  process.send({
    pid:process?.pid,
    pid_index:global["pid_index"],
    data:down_file_object
  })
}
process.on('message', async (message_data) => {
  if(!global["json_config"]){
    global["json_config"]=require("../config.js");   
  }
  if(!global["class_s3"]){
    await Help.Init_S3()
  }
  let {pid_index,data}=message_data
  global["pid_index"]=pid_index
  one_file_download(data);
});
